package db;

import android.content.Context;

import component.GetDataComponet;
import component.GetDataComponetImpl;

import dominain.AbstractExeDTO;
import dominain.SystemDTO;
import error.JException;

public class ExeDTO extends AbstractExeDTO {


	/** The exe dto. */
	private static AbstractExeDTO exeDTO = null;

	/** The get data componet. */
	private transient GetDataComponet getDataComponet;

	/**
	 * Gets the exe dto.
	 *
	 * @param context the context
	 * @return the exe dto
	 */
	public static AbstractExeDTO getExeDTO(Context context) {
		if (null == exeDTO) {
			exeDTO = new ExeDTO(context);

		}
		// 檢查是否有第一次進入本app-如果是的話

		return exeDTO;
	}

	/**
	 * Instantiates a new exe dto.
	 *
	 * @param context the context
	 */
	private ExeDTO(Context context) {

		this.setContext(context);

	}

	/* (non-Javadoc)
	 * @see com.controller.love.domain.AbstractExeDTO#getSystemDTO()
	 */
	@Override
	public SystemDTO getSystemDTO() throws JException {

		getDataComponet = new GetDataComponetImpl();

		return getDataComponet.getSystemDTO(this.getContext());
	}

	/* (non-Javadoc)
	 * @see com.controller.love.domain.AbstractExeDTO#getUserId()
	 */
	@Override
	public String getUserId() throws JException {

		return this.getSystemDTO().getUserId();
	}

	/* (non-Javadoc)
	 * @see com.controller.love.domain.AbstractExeDTO#getUserName()
	 */
	@Override
	public String getUserName() throws JException {

		return this.getSystemDTO().getUserName();
	}


}
